a65a0f
@@ -382,11 +382,10 @@
private OperationHandle executeStatementInternal(String statement, Map<String, S
       opHandleSet.add(opHandle);
       return opHandle;
     } catch (HiveSQLException e) {
-      // Cleanup opHandle in case the query is synchronous
-      // Async query needs to retain and pass back the opHandle for error reporting
-      if (!runAsync) {
-        operationManager.closeOperation(opHandle);
-      }
+      // Refering to SQLOperation.java,there is no chance that a HiveSQLException throws and the asyn
+      // background operation submits to thread pool successfully at the same time. So, Cleanup
+      // opHandle directly when got HiveSQLException
+      operationManager.closeOperation(opHandle);
       throw e;
     } finally {
       release(true);
